package edu.avans.hartigehap.domain;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Transient;

@Entity
public class WebTopping extends WebPizzaDecorator implements Serializable{
	private static final long serialVersionUID = 1L;


	private WebMenuItem menuTopping;


	public WebTopping() {

	}

	public WebTopping(MenuTopping menuTopping) {
		this.menuTopping = menuTopping;
	}

	public WebTopping(WebPizzaBase pizzaBase) {
		this.pizzaBase = pizzaBase;
	}

	@Transient
	public BigDecimal getPrice() {
		return menuTopping.getPrice();
	}

	@Transient
	public void setPrice(BigDecimal price) {

	}

	@Transient
	public String getDishName() {
		return menuTopping.getDishName();
	}

	@Transient
	public void setDishName(String pizzaName) {

	}

	@Transient
	public BigDecimal getTotalPrice() {
		BigDecimal p = pizzaBase.getTotalPrice().add(getPrice());
		return p;
	}

	@Transient
	public String getTotalName() {
		String n = pizzaBase.getTotalName() + " met " + getDishName();
		return n;
	}


	@OneToOne()
	@JoinColumn(name="WEBMENUITEM_ID",referencedColumnName="WEBMENUITEM_ID")
	public WebMenuItem getMenuTopping() {
		return menuTopping;
	}

	public void setMenuTopping(WebMenuItem menuTopping) {
		this.menuTopping = menuTopping;
	}




}
